@extends('public.home_base')
@section('title', '提交工单')

@section('content')
    @parent
    <div class="w1200 auto gd_system">
        <div class="tabout">
            <ul class="gd_tab">
                <li class="tab_active"><a href="gongdan">提交工单</a></li>
                <li><a href="dgongdan">待处理工单</a></li>
                <li><a href="gdlist">所有工单</a></li>
            </ul>
        </div>
        <div>
            <form name="mygdform" method="post" id="mygdform">
                <div class="gd_form " style="display: block;">
                    {{csrf_field()}}
                    <dl>
                        <dt>工单标题：</dt>
                        <dd>
                            <input type="text" placeholder="请输入问题简要介绍" class="inputtext" name="title"> 必填项
                        </dd>
                    </dl>

                    <div id="gdform_moban">
                        <dl>
                            <dt>客服对象：</dt>
                            <dd><input type="text" class="inputtext" class="inputtext" name="kf"
                                       placeholder="选填：请输入客服昵称 或 账号">
                                如果您已联系过客服，可填写他的信息，有助于我们即时为您转交。
                            </dd>
                        </dl>
                    </div>
                    <dl>
                        <dt>问题描述：</dt>
                        <dd>
                            <textarea name="content" rows="15" cols="90"></textarea>
                        </dd>
                    </dl>
                    <dl>
                        <dt>回复通知：</dt>
                        <dd>
                            <label class="fl"> <input type="checkbox" name="reply_sms" value="1" style="margin-right: 5px">
                                短信通知我 </label>
                        </dd>
                    </dl>
                    <dl>
                        <dt>&nbsp;</dt>
                        <dd>
                            <div id="gdform_message" class="redcolor"></div>
                            <input id="btnsubmit" class="btn btn_primary" value="提交工单">
                        </dd>
                        <div class="fr" id="attimglist"></div>
                        <div class="clear"></div>

                    </dl>
                </div>
            </form>
        </div>
    </div>

@endsection
@section('script')
    <script>
        $(function () {
            $('#btnsubmit').on('click', function () {
                $.ajax({
                    dataType: 'json',
                    url: 'gongdan',
                    data: $('#mygdform').serialize(),
                    type: "post",
                    success: function (res) {
                        if (res.code === 0) {
                            layer.msg(res.msg,{
                                 icon: 1,
                                 time: 2000
                            },function () {
                                window.location.reload();
                            });
                        } else {
                            layer.msg(res.msg,{
                                icon: 2,
                                time: 2000
                            },function () {
                                window.location.reload();
                            });
                        }
                    }
                });
            });

        })
    </script>
@endsection